import { AxiosResponse } from 'axios';
import { Get, Post } from '../axios';



/* 删除苹果分发应用*/
interface DelipaInterface {
    (data: {
        id: string,                     /*苹果分发应用id*/
    }): Promise<AxiosResponse<any>>
}
export const delipa: DelipaInterface = async (data) => {
    try {
        return await Post({ url: "/ipamod/delipa", data });
    } catch (error) {
        throw error
    }
}



/* 修改苹果分发应用 */
interface UpipaInterface {
    (data: {
        id: string,                    /* 苹果分发id */
        remarks?: string,              /* 备注 */
        merge?: string,                /* 合并参数 */
        codestatus?: boolean,          /* 是否需要下载码 */
        accountPool?: string           /* 证书池 */
    }): Promise<AxiosResponse<any>>
}
export const upipa: UpipaInterface = async (data) => {
    try {
        return await Post({ url: "/ipamod/upipa", data });
    } catch (error) {
        throw error
    }
}



/* 查询苹果分发应用 */
interface GetipaInterface {
    (data: {
        pageNo: number,                    /* 当前页数 */
        pageSize: number,                  /* 页面总条数 */
        id?: string | null
    }): Promise<AxiosResponse<any>>
}
export const getipa: GetipaInterface = async (data) => {
    try {
        return await Post({ url: "/ipamod/getipa", data });
    } catch (error) {
        throw error
    }
}



/* 搜索苹果分发应用 */
interface SchipaInterface {
    (data: {
        remarks: string                     /*备注*/
    }): Promise<AxiosResponse<any>>
}
export const schipa: SchipaInterface = async (data) => {
    try {
        return await Get({ url: "/ipamod/searchios", data });
    } catch (error) {
        throw error
    }
}
